package cn.edu.stu.syllabus.adapters;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.edu.stu.syllabus.R;
import cn.edu.stu.syllabus.base.BaseQuickClickAdapter;
import cn.edu.stu.syllabus.repository.booklocate.local.BookLocateEntry;

/**
 * Created by liyujie on 2017/3/29.
 */

public class BookLocateAdapter extends BaseQuickClickAdapter<BookLocateEntry, BookLocateAdapter.ViewHolder> {

    @Override
    protected ViewHolder createBaseViewHolder(View view) {
        return new ViewHolder(view);
    }

    public BookLocateAdapter(List<BookLocateEntry> data) {
        super(R.layout.item_book_locate, data);
    }

    @Override
    protected void convert(ViewHolder helper, BookLocateEntry item) {
        helper.mLocateNameTextView.setText(item.getBook());
        helper.mLocateStateTextView.setText(item.getState());
        helper.mLocateTypeTextView.setText(item.getType());
    }

    public class ViewHolder extends BaseViewHolder {
        @Nullable
        @BindView(R.id.locateNameTextView)
        TextView mLocateNameTextView;
        @Nullable
        @BindView(R.id.locateStateTextView)
        TextView mLocateStateTextView;
        @Nullable
        @BindView(R.id.locateTypeTextView)
        TextView mLocateTypeTextView;

        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
